
var ns, toast,Dialog;
var app = new Vue({
    el: '#app',
    data: {
        OrderID: '',
        baseyunfei:'',
        timeryunfei:'',
        proPrice:'',
        totalcost:'',
        form:{
            ShipRateAmount:'',
            ShipTimeAmount:'',
            PackingFee:'',
            TotalCost:'',
            LasTotalCost:'',
        },
        
    },
    computed:{       
        lastotalcost:{  
            get:function() {
                return Number(this.totalcost) + Number(this.proPrice) + Number(this.timeryunfei) + Number(this.baseyunfei)
            }, 
            set:function(){
            }      
        }
    },
    methods: {
        do_save:function(){
            var that=this;
            var option={};
            option.OrderID=that.OrderID;
            option.ShipRateAmount=that.baseyunfei;
            option.ShipTimeAmount=that.timeryunfei;
            option.PackingFee=that.proPrice;
            option.action='saveordertransportprice';
            ns.post(option, function(succeed, data, err) {
                if(succeed){
                    api.toast({
                        msg: '保存成功',
                        duration: 2000,
                        location: 'bottom'
                    });
                    api.sendEvent({
                        name: 'edit_fee'
                    });
                    setTimeout(function() {
                        api.closeWin();
                    }, 500);

                }else{
                    api.toast({
                        msg: err,
                        duration: 2000,
                        location: 'bottom'
                    });
                }
            });

        }
    }
});
apiready = function() {
    api.parseTapmode();
    ns = window.Foresight.Util;
    app.OrderID = api.pageParam.OrderID;
    app.baseyunfei = api.pageParam.ShipRateAmount;
    app.timeryunfei = api.pageParam.ShipTimeAmount;
    app.proPrice = api.pageParam.PackingFee;
    app.totalcost = api.pageParam.TotalCost;
    app.lastotalcost=app.totalcost+app.proPrice+app.timeryunfei+app.baseyunfei;


    app.form.ShipRateAmount = api.pageParam.ShipRateAmount;
    app.form.ShipTimeAmount = api.pageParam.ShipTimeAmount;
    app.form.PackingFee = api.pageParam.PackingFee;
    app.form.TotalCost = api.pageParam.TotalCost;
    app.form.LasTotalCost=app.form.TotalCost+app.form.ShipRateAmount+app.form.ShipTimeAmount+app.form.PackingFee;

};
